package com.interview.ujiuye9;

interface IVideo{
	void record();//视频
}
interface INote{
	void edit();//笔记
}
//抽象工厂接口
interface CourseFactory{
	INote createNode();//创建笔记产品    格力空调
	IVideo createVideo();//创建食品产品  格力冰箱
}
//创建具体的产品
class JavaVideo implements IVideo{
	@Override
	public void record() {
		System.out.println("录制Java视频");
	}	
}
class JavaNote implements INote{
	@Override
	public void edit() {
		System.out.println("编写java笔记");
	}
}
class JavaCourseFactory implements CourseFactory{
	@Override
	public INote createNode() {
		return new JavaNote();
	}

	@Override
	public IVideo createVideo() {
		return new JavaVideo();
	}
}
//========python另一个产品系============
class PythonVideo implements IVideo{
	@Override
	public void record() {
		System.out.println("录制Python视频");
	}
}
class PythonNote implements INote{
	@Override
	public void edit() {
		System.out.println("编写Python笔记");
	}
}
class PythonCourseFactory implements CourseFactory{
	@Override
	public INote createNode() {
		return new PythonNote();
	}
	@Override
	public IVideo createVideo() {
		return new PythonVideo();
	}
}
public class AbstractFactoryDemo {

	public static void main(String[] args) {
		CourseFactory javaCourseFactory = new JavaCourseFactory();
		javaCourseFactory.createNode().edit();
		javaCourseFactory.createVideo().record();
		
		CourseFactory pythonCourseFactory = new PythonCourseFactory();
		pythonCourseFactory.createNode().edit();
		pythonCourseFactory.createVideo().record();
	}
}